//
//  TYZNetworkingTool.h
//  kanhujia
//
//  Created by lxl on 2018/5/14.
//  Copyright © 2018年 lxl. All rights reserved.
//

#import <Foundation/Foundation.h>
@class AFHTTPSessionManager;
/**
 *  控制信号值类型的数值
 */
#define WIFIValueLow           -80
#define WIFIValueHigh          -60
#define SIMValueLow            20
#define SIMValueHigh           60
/**
 *  网络连接类型
 */
typedef NS_ENUM(NSInteger, NetworkType) {
    NetworkType_None = 0,
    NetworkType_Wifi = 1,
    NetworkType_2G   = 2,
    NetworkType_3G   = 3,
    NetworkType_4G   = 4,
    NetworkType_5G   = 5
};
/**
 *  信号强度类型
 */
typedef NS_ENUM(NSInteger, NetworkIntensity) {
    NetworkIntensity_Default = 0, // 没有信号
    NetworkIntensity_Low     = 1, // <-80
    NetworkIntensity_Mid     = 2, // -80~-60
    NetworkIntensity_High    = 3, // >-60
};

#define NetTool [TYZNetworkingTool initial]
@interface TYZNetworkingTool : NSObject
/**
 *  请求的路由地址
 */
@property(nonatomic, copy) NSString *url;
/**
 *  请求管理者
 */
@property(nonatomic, strong) AFHTTPSessionManager *manager;
/**
 *  网络连接类型
 */
@property(nonatomic, assign) NetworkType networkType;
/**
 *  信号值
 */
@property(nonatomic, assign) NSInteger intentsityValue;
/**
 *  信号强度类型
 */
@property(nonatomic, assign) NetworkIntensity networkIntensity;
/**
 *  初始化
 */
+ (instancetype)initial;
/**
 *  登录后的参数增加
 */
@property(nonatomic, strong) NSDictionary *parameter;
/**
 检测版本
 
 @param compelment 完成回调
 */
- (void)checkAppVersionCompelment:(void(^)(NSArray *result))compelment;

/**
 账号登出
 
 @param complement 登出完成
 */
- (void)logoutWithComplement:(void(^)(NSString *result))complement;

/**
 用户登录
 
 @param userName 用户名
 @param password 密码
 @param complement 登录完成
 */
- (void)logginWithUserName:(NSString *)userName password:(NSString *)password complement:(void(^)(NSDictionary *result))complement;

/**
 POST请求
 
 @param code 请求代码
 @param parameter 请求参数
 @param success 请求成功
 @param failure 请求失败
 */
- (void)postWithCode:(NSString *)code parameter:(NSDictionary *)parameter success:(void (^)(NSDictionary *result))success failure:(void (^)(NSString *error))failure;
@end
